import { contextBridge } from 'electron'
import { electronAPI } from '@electron-toolkit/preload/dist'

// Custom APIs for renderer
const api = {}

if (process.contextIsolated) {
  try {
    // 将electronAPI和api暴露给渲染进程
    contextBridge.exposeInMainWorld('electron', electronAPI)
    contextBridge.exposeInMainWorld('api', api)
  } catch (error) {
    console.error(error)
  }
} else {
  // 将electronAPI和api暴露给window对象
  window.electron = electronAPI
  window.api = api
}


